[백준]단계별풀이_기본수학1


백준 단계별풀이 - 기본수학 1

1712번 : 손익분기점

https://www.acmicpc.net/problem/1712

a, b, c = map(int, input().rstrip().split())

count = 1
if b >= c:
    print(-1)
else:
    print(int(a/(c-b))+1)

2292번 : 벌집

https://www.acmicpc.net/problem/2292

a = int(input().rstrip())

cnt = 1
increase_number = 1
plus = 6

if a == 1:
    print(1)
else:
    while True:
        increase_number += plus
        cnt += 1
        if increase_number >= a:
            print(cnt)
            break
        plus += 6

1193번 : 분수찾기

https://www.acmicpc.net/problem/1193

x = int(input().strip())

line = 1
while x > line:
    x -= line
    line += 1

if line % 2 == 0:
    a = x
    b = line-x+1
else:
    b = x
    a = line-x+1

print(f'{a}/{b}')

2869번 : 달팽이는 올라가고 싶다

https://www.acmicpc.net/problem/2869

a, b, c = map(int, input().rstrip().split())

answer = 0

if (c - b) % (a - b) != 0:
    answer = ((c - b) // (a - b)) + 1
else:
    answer = ((c - b) // (a - b))
print(answer)

10250번 : ACM 호텔

https://www.acmicpc.net/problem/10250

t = int(input().rstrip())

for _ in range(t):
    h, w, n = map(int, input().rstrip().split())
    a = n % h
    b = n // h + 1
    if a == 0:
        a = h
        b -= 1
    print(a * 100 + b)

2775번 : 부녀회장이 될테야

https://www.acmicpc.net/problem/2775

t = int(input().rstrip())

for _ in range(t):
    k = int(input())
    n = int(input())
    people = [i for i in range(1, n+1)]
    for _ in range(k):
        for j in range(1, n):
            people[j] += people[j-1]
    print(people[-1])

2839번 : 설탕 배달

https://www.acmicpc.net/problem/2839

kg = int(input())

ans = 0

while True:
    if kg % 5 == 0:
        ans += (kg//5)
        print(ans)
        break
    kg -= 3
    ans += 1
    if kg < 0:
        print(-1)
        break

10757번 : 큰 수 A+B

https://www.acmicpc.net/problem/10757

※ 임의 정밀도 참고

a, b = map(int, input().rstrip().split())

print(a+b)

1011번 : Fly me to the Alpha Centauri

https://www.acmicpc.net/problem/1011

t = int(input())

for _ in range(t):
    x, y = map(int,input().split())
    distance = y - x
    count = 0  # 이동 횟수
    move = 1  # count별 이동 가능한 거리
    move_plus = 0  # 이동한 거리의 합
    while move_plus < distance :
        count += 1
        move_plus += move  # count 수에 해당하는 move를 더함
        if count % 2 == 0 :  # count가 2의 배수일 때,
            move += 1
    print(count)

위로 올라가기💨

Hello, I'm@nickhealthy
개발자를 꿈꾸고, 파이썬과 클라우드에 관심이 많은 비전공자

Github